﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BPM.Base.Tools
{
    public static class MyLog
    {
        public static void writeError(string message)
        {
            string isLog = MyConfig.getAppValue("isLog");
            if (!string.IsNullOrEmpty(isLog))
             {
                 if (isLog == "true")
                 {
                     System.Diagnostics.EventLog sj;
                     sj = new System.Diagnostics.EventLog();
                     sj.MachineName = ".";
                     sj.Log = "Application"; 
                     sj.Source = "BPM";


                     sj.WriteEntry(message, System.Diagnostics.EventLogEntryType.Error, 100, 100, null);
                 }
             }

        }


        public static void writeInfo(string message)
        {
            string isLog = MyConfig.getAppValue("isLog");
            if (!string.IsNullOrEmpty(isLog))
            {
                if (isLog == "true")
                {
                    System.Diagnostics.EventLog sj;
                    sj = new System.Diagnostics.EventLog();
                    sj.MachineName = ".";
                    sj.Log = "Application";
                    sj.Source = "BPM";


                    sj.WriteEntry(message, System.Diagnostics.EventLogEntryType.Information, 100, 100, null);
                }
            }

        }
    }
}
